import 'package:flutter/material.dart';
import 'package:flutter_syt/datas/venue_item.dart';
import 'package:flutter_syt/domain/widgets/simple_image_loader.dart';
import 'package:flutter_syt/theme/theme_color.dart';

class VenueDetailCover extends StatelessWidget {
  final VenueItem? entity;

  VenueDetailCover(this.entity, {Key? key});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(bottom: 40),
      child: ClipRRect(
        borderRadius: BorderRadius.only(
          bottomLeft: const Radius.circular(24),
          bottomRight: const Radius.circular(24),
        ),
        child: Stack(
          children: [
            Container(
              height: 375,
              width: double.infinity,
              decoration: BoxDecoration(
                color: ThemeColor.ckColorFFFFFF,
              ),
              child: ImageLoader.loadImage(
                imageUrl:
                    'https://scrm-pic.cdn.buerkongjian.com/5ae9/68b8/5ae968b89b986a9045de3196ea08c639.jpg',
              ),
            ),
            Positioned(
              bottom: 0,
              child: _coverContent(context),
            )
          ],
        ),
      ),
    );
  }

  Widget _coverContent(BuildContext context) {
    return Container(
      alignment: Alignment.topLeft,
      width: MediaQuery.of(context).size.width,
      padding: EdgeInsets.only(left: 16, right: 16, bottom: 28),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Padding(
            padding: EdgeInsets.only(top: 15),
            child: Text(
              entity!.name,
              maxLines: 2,
              softWrap: false,
              overflow: TextOverflow.ellipsis,
              style: TextStyle(
                fontSize: 24,
                color: Color(0xffffffff),
              ),
            ),
          ),
          Padding(
            padding: EdgeInsets.only(top: 15),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  width: 280,
                  child: Text(
                    entity!.address,
                    maxLines: 2,
                    softWrap: false,
                    overflow: TextOverflow.ellipsis,
                    style: TextStyle(
                      fontSize: 14,
                      color: Color(0xffffffff),
                    ),
                  ),
                ),
                Container(
                  child: Column(
                    children: [
                      Icon(
                        Icons.assistant_navigation,
                        color: Colors.white,
                        size: 20,
                      ),
                      SizedBox(
                        height: 5,
                      ),
                      Text(
                        '2.3km',
                        style: TextStyle(
                          fontSize: 10,
                          color: Color(0xffffffff),
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
